package com.ks.util;

import java.math.BigDecimal;
import java.text.DecimalFormat;

public class ConvertUtils {

    private static final DecimalFormat simpleFormat = new DecimalFormat("####");

    public static final boolean objectToBoolean(Object o) {

        return o != null ? Boolean.valueOf(o.toString()).booleanValue() : false;

    }

    public static final int objectToInt(Object o) {

        if (o instanceof Number) {

            return ((Number) o).intValue();

        } else {

            try {

                if (o == null) {

                    return -1;

                } else {

                    BigDecimal bigDecimal = new BigDecimal(o.toString());

                    bigDecimal.intValue();

                    return bigDecimal.intValue();

                }

            } catch (Exception var2) {

                var2.printStackTrace();

                return -1;

            }

        }

    }

}
